package index

import (
	"net/http"

	"github.com/gin-gonic/gin"
	"watch_script_state/piugins/mqtt"
)

func IndexPage(c *gin.Context) {
	mqttInfo := mqtt.GetMqttServerInfo()
	c.HTML(http.StatusOK, "index.html", gin.H{
		"plugins_name":        mqttInfo.Name,
		"plugins_description": mqttInfo.Description,
		"plugins_state":       mqttInfo.State,
	})
}

func MqttProtocolPage(c *gin.Context) {
	protocolArray := mqtt.GetProtocolDataFromJson()
	c.HTML(http.StatusOK, "mqtt_protocol.html", gin.H{
		"protocol_array": protocolArray,
	})
}
